package models

import (
	"time"
)

type User struct {
	Id                      int64     `json:"id"`
	Username                string    `json:"username"`
	Password                string    `json:"password"`
	DepartmentId            int64     `json:"departmentId"`
	OpenId                  string    `json:"openId"`
	Phone                   string    `json:"phone"`
	Name                    string    `json:"name"`
	Avatar                  string    `json:"avatar"`
	Type                    int       `json:"type"`
	AccountNonExpirable     bool      `json:"accountNonExpirable"`
	AccountNonLockable      bool      `json:"accountNonLockable"`
	CredentialsNonExpirable bool      `json:"credentialsNonExpirable"`
	Enabled                 bool      `json:"enabled"`
	CreatedDate             time.Time `json:"createdDate"`
	UpdatedDate             time.Time `json:"updatedDate"`
	Roles                   []*Role   `json:"roles,omitempty" gorm:"many2many:sys_user__role;foreignKey:Id;joinForeignKey:user_id;joinReferences:role_id;"`
}

func (u *User) TableName() string {
	return "sys_user"
}
